package org.giovanolli.mumi.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * The Class Payment.
 */
@Entity
@Table(name = "payment")
public class Payment extends IdentificableEntity {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -5018169531114957394L;

	/** The date. */
	@Column(name = "date")
	private Date date;

	/** The amount. */
	@Column(name = "amount")
	private Double amount;

	/** The payment type. */
	@Enumerated(EnumType.STRING)
	@Column(name = "payment_type")
	private PaymentType paymentType;

	/** The patient prepaid. */
	@ManyToOne
	@JoinColumn(name = "patient_prepaid_id")
	private PatientPrepaid patientPrepaid;

	/** The bill. */
	@OneToOne
	@JoinColumn(name = "payment_id")
	private Bill bill;

	/**
	 * Gets the amount.
	 * 
	 * @return the amount
	 */
	public Double getAmount() {
		return amount;
	}

	/**
	 * Gets the bill.
	 * 
	 * @return the bill
	 */
	public Bill getBill() {
		return bill;
	}

	/**
	 * Gets the date.
	 * 
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}

	/**
	 * Gets the patient prepaid.
	 * 
	 * @return the patient prepaid
	 */
	public PatientPrepaid getPatientPrepaid() {
		return patientPrepaid;
	}

	/**
	 * Gets the payment type.
	 * 
	 * @return the payment type
	 */
	public PaymentType getPaymentType() {
		return paymentType;
	}

	/**
	 * Sets the amount.
	 * 
	 * @param amount
	 *            the new amount
	 */
	public void setAmount(Double amount) {
		this.amount = amount;
	}

	/**
	 * Sets the bill.
	 * 
	 * @param bill
	 *            the new bill
	 */
	public void setBill(Bill bill) {
		this.bill = bill;
	}

	/**
	 * Sets the date.
	 * 
	 * @param date
	 *            the new date
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * Sets the patient prepaid.
	 * 
	 * @param patientPrepaid
	 *            the new patient prepaid
	 */
	public void setPatientPrepaid(PatientPrepaid patientPrepaid) {
		this.patientPrepaid = patientPrepaid;
	}

	/**
	 * Sets the payment type.
	 * 
	 * @param paymentType
	 *            the new payment type
	 */
	public void setPaymentType(PaymentType paymentType) {
		this.paymentType = paymentType;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.giovanolli.mumi.entities.IdentificableEntity#toString()
	 */
	@Override
	public String toString() {
		return "Payment [date=" + date + ", amount=" + amount + ", paymentType=" + paymentType + ", patientPrepaid=" + patientPrepaid + "]";
	}

}
